'use strict';
const dayjs = require('dayjs');

class Kzz {
  constructor(requestReptile) {
    this.requestReptile = requestReptile;
  }

  async getNewKzz() {
    const url = 'https://www.jisilu.cn/data/cbnew/pre_list/?___jsl=LST___t=1599050402852';
    const res = await this.requestReptile(url);
    const date = '2020-08-20';
    return res.rows.filter(item => {
      return date === item.cell.apply_date;
    }).map(item => {
      return {
        id: item.id,
        code: item.cell.apply_cd,
        bond_nm: item.cell.bond_nm,
        pma_rt: item.cell.pma_rt,
        rating_cd: item.cell.rating_cd,
        apply_date: item.cell.apply_date
      };
    });
  }
}

module.exports = Kzz;
